import Main from '@/components/main'
import parentView from '@/components/parent-view'

/**
 * iview-admin中meta除了原生参数外可配置的参数:
 * meta: {
 *  title: { String|Number|Function }
 *         显示在侧边栏、面包屑和标签栏的文字
 *         使用'{{ 多语言字段 }}'形式结合多语言使用，例子看多语言的路由配置;
 *         可以传入一个回调函数，参数是当前路由对象，例子看动态路由和带参路由
 *  hideInBread: (false) 设为true后此级路由将不会出现在面包屑中，示例看QQ群路由配置
 *  hideInMenu: (false) 设为true后在左侧菜单不会显示该页面选项
 *  notCache: (false) 设为true后页面在切换标签后不会缓存，如果需要缓存，无需设置这个字段，而且需要设置页面组件name属性和路由配置的name一致
 *  access: (null) 可访问该页面的权限数组，当前路由设置的权限会影响子路由
 *  icon: (-) 该页面在左侧菜单、面包屑和标签导航处显示的图标，如果是自定义图标，需要在图标名称前加下划线'_'
 *  beforeCloseName: (-) 设置该字段，则在关闭当前tab页时会去'@/router/before-close.js'里寻找该字段名对应的方法，作为关闭前的钩子函数
 * }
 */

export default [

  {
    path: '/login',
    name: 'login',
    meta: {
      title: 'Login - 登录',
      hideInMenu: true
    },
    component: () => import('@/view/login/login.vue')
  },
  {
    path: '/',
    name: '_home',
    redirect: '/home',
    component: Main,
    meta: {
      hideInMenu: true,
      notCache: true
    },
    children: [
      {
        path: '/home',
        name: 'home',
        meta: {
          hideInMenu: true,
          title: '首页',
          notCache: true,
          icon: 'md-home'
        },
        component: () => import('@/view/single-page/home')
      },
      // 刷新页面 必须保留
      {
        path: 'refresh',
        name: 'refresh',
        hidden: true,
        component: {
          beforeRouteEnter (to, from, next) {
            next(vm => vm.$router.replace(from.fullPath))
          },
          render: h => h()
        }
      },
      // 页面重定向 必须保留
      {
        path: 'redirect/:route*',
        name: 'redirect',
        hidden: true,
        component: {
          beforeRouteEnter (to, from, next) {
            next(vm => vm.$router.replace(JSON.parse(from.params.route)))
          },
          render: h => h()
        }
      }
    ]
  },

  {
    path: '/message',
    name: 'message',
    component: Main,
    meta: {
      hideInBread: true,
      hideInMenu: true
    },
    children: [
      {
        path: 'message_page',
        name: 'message_page',
        meta: {
          icon: 'md-notifications',
          title: '消息中心'
        },
        component: () => import('@/view/single-page/message/index.vue')
      }
    ]
  },

  {
    path: '/argu',
    name: 'argu',
    meta: {
      hideInMenu: true
    },
    component: Main,
    children: [
      {
        path: 'params/:id',
        name: 'params',
        meta: {
          icon: 'md-flower',
          title: route => `{{ params }}-${route.params.id}`,
          notCache: true,
          beforeCloseName: 'before_close_normal'
        },
        component: () => import('@/view/argu-page/params.vue')
      },
      {
        path: 'query',
        name: 'query',
        meta: {
          icon: 'md-flower',
          title: route => `{{ query }}-${route.query.id}`,
          notCache: true
        },
        component: () => import('@/view/argu-page/query.vue')
      }
    ]
  },
  {
    path: '/401',
    name: 'error_401',
    meta: {
      hideInMenu: true
    },
    component: () => import('@/view/error-page/401.vue')
  },
  {
    path: '/500',
    name: 'error_500',
    meta: {
      hideInMenu: true
    },
    component: () => import('@/view/error-page/500.vue')
  },
  {
    path: '*',
    name: 'error_404',
    meta: {
      hideInMenu: true
    },
    component: () => import('@/view/error-page/404.vue')
  },
  {
    path: '/management',
    name: 'management',
    meta: {
      icon: 'md-cloud-upload',
      title: '商户管理'
    },
    component: Main,
    children: [
      // {
      //   path: 'bankCardList',
      //   name: 'bankCardList',
      //   meta: {
      //     icon: 'ios-document',
      //     title: '出款卡列表'
      //   },
      //   component: () => import('@/view/management/bankCardList.vue')
      // },
      {
        path: 'merchants',
        name: 'merchants',
        meta: {
          icon: 'md-clipboard',
          title: '所有商户'
        },
        component: () => import('@/view/management/merchants.vue')
      },
      {
        path: 'capital',
        name: 'capital',
        meta: {
          icon: 'md-clipboard',
          title: '资金流水'
        },
        component: () => import('@/view/management/capital.vue')
      },
      {
        path: 'cap-view',
        name: 'cap-view',
        meta: {
          icon: '_qq',
          title: '查看',
          hideInBread: true,
          hideInMenu: true
        },
        component: () => import('@/view/management/cap-view.vue')
      },
      {
        path: 'ban-edit',
        name: 'ban-edit',
        meta: {
          icon: '_qq',
          title: '编辑',
          hideInBread: true,
          hideInMenu: true
        },
        component: () => import('@/view/management/ban-edit.vue')
      },
      {
        path: 'mer-edit',
        name: 'mer-edit',
        meta: {
          icon: '_qq',
          title: '编辑',
          hideInBread: true,
          hideInMenu: true
        },
        component: () => import('@/view/management/mer-edit.vue')
      },
      {
        path: 'mer-view',
        name: 'mer-view',
        meta: {
          icon: '_qq',
          title: '查看信息',
          hideInBread: true,
          hideInMenu: true
        },
        component: () => import('@/view/management/mer-view.vue')
      },
      {
        path: 'mer-dispatch',
        name: 'mer-dispatch',
        meta: {
          icon: '_qq',
          title: '代付调度',
          hideInBread: true,
          hideInMenu: true
        },
        component: () => import('@/view/management/mer-dispatch.vue')
      },
      {
        path: 'mer-change',
        name: 'mer-change',
        meta: {
          icon: '_qq',
          title: '余额变更',
          hideInBread: true,
          hideInMenu: true
        },
        component: () => import('@/view/management/mer-change.vue')
      },
      {
        path: 'mer-add',
        name: 'mer-add',
        meta: {
          icon: '_qq',
          title: '新增',
          hideInBread: true,
          hideInMenu: true
        },
        component: () => import('@/view/management/mer-add.vue')
      }
    ]
  },
  {
    path: '/order_management',
    name: 'order_management',
    meta: {
      icon: 'md-cloud-upload',
      title: '订单管理',
      showAlways: true
    },
    component: Main,
    children: [
      {
        path: 'offline_record',
        name: 'offline_record',
        meta: {
          icon: 'ios-document',
          title: '线下充值记录'
        },
        component: () => import('@/view/order-management/offline_record.vue')
      },
      {
        path: 'off_check',
        name: 'off_check',
        meta: {
          icon: '_qq',
          title: '审核',
          hideInBread: true,
          hideInMenu: true
        },
        component: () => import('@/view/order-management/off_check.vue')
      }
    ]
  },
  // {
  //   path: '/pay_set',
  //   name: 'pay_set',
  //   meta: {
  //     icon: 'md-cloud-upload',
  //     title: '支付配置',
  //     showAlways: true
  //   },
  //   component: Main,
  //   children: [
  //     {
  //       path: 'account_payee',
  //       name: 'account_payee',
  //       meta: {
  //         icon: 'ios-document',
  //         title: '收款账户'
  //       },
  //       component: () => import('@/view/pay-set/account-payee.vue')
  //     }
  //   ]
  // },
  {
    path: '/paid_management',
    name: 'paid_management',
    meta: {
      icon: 'md-cloud-upload',
      title: '代付管理'
    },
    component: Main,
    children: [
      {
        path: 'artificial_staff',
        name: 'artificial_staff',
        meta: {
          icon: 'ios-document',
          title: '人工客服'
        },
        component: () => import('@/view/paid-management/artificial-staff.vue')
      },
      {
        path: 'paid_order',
        name: 'paid_order',
        meta: {
          icon: 'ios-document',
          title: '代付订单'
        },
        component: () => import('@/view/paid-management/paid-order.vue')
      },
      {
        path: 'paid-order-details',
        name: 'paid-order-details',
        meta: {
          icon: '_qq',
          title: '详情',
          hideInBread: true,
          hideInMenu: true
        },
        component: () => import('@/view/paid-management/paid-order-details.vue')
      },
      {
        path: 'artifcial-order-details',
        name: 'artifcial-order-details',
        meta: {
          icon: '_qq',
          title: '详情',
          hideInBread: true,
          hideInMenu: true
        },
        component: () => import('@/view/paid-management/artifcial-order-details')
      },

      {
        path: 'channel-add',
        name: 'channel-add',
        meta: {
          icon: '_qq',
          title: '新增通道',
          hideInBread: true,
          hideInMenu: true
        },
        component: () => import('@/view/paid-management/channel-add')
      },
      {
        path: 'channel-edit',
        name: 'channel-edit',
        meta: {
          icon: '_qq',
          title: '编辑',
          hideInBread: true,
          hideInMenu: true
        },
        component: () => import('@/view/paid-management/channel-edit')
      },
      // {
      //   path: 'artificial_order',
      //   name: 'artificial_order',
      //   meta: {
      //     icon: 'ios-document',
      //     title: '人工订单'
      //   },
      //   component: () => import('@/view/paid-management/artificial-order.vue')
      // },
      {
        path: 'kf_capital',
        name: 'kf_capital',
        meta: {
          icon: 'ios-document',
          title: '资金流水'
        },
        component: () => import('@/view/paid-management/kf-capital.vue')
      },
      {
        path: 'paid_channel',
        name: 'paid_channel',
        meta: {
          icon: 'ios-document',
          title: '代付通道'
        },
        component: () => import('@/view/paid-management/paid-channel.vue')
      }
    ]
  },
  // {
  //   path: '/data_analysis',
  //   name: 'data_analysis',
  //   meta: {
  //     icon: 'md-cloud-upload',
  //     title: '数据分析'
  //   },
  //   component: Main,
  //   children: [
  //     {
  //       path: 'merchant_recharge_ranking',
  //       name: 'merchant_recharge_ranking',
  //       meta: {
  //         icon: 'ios-document',
  //         title: '商户充值排行'
  //       },
  //       component: () => import('@/view/data-analysis/merchant-recharge-ranking.vue')
  //     },
  //     {
  //       path: 'agent_run_ranking',
  //       name: 'agent_run_ranking',
  //       meta: {
  //         icon: 'ios-document',
  //         title: '代理商分润排行'
  //       },
  //       component: () => import('@/view/data-analysis/agent-run-ranking.vue')
  //     },
  //     {
  //       path: 'paid_product_statistical',
  //       name: 'paid_product_statistical',
  //       meta: {
  //         icon: 'ios-document',
  //         title: '支付产品统计'
  //       },
  //       component: () => import('@/view/data-analysis/paid-product-statistical.vue')
  //     },
  //     {
  //       path: 'success_rate',
  //       name: 'success_rate',
  //       meta: {
  //         icon: 'ios-document',
  //         title: '成功率统计'
  //       },
  //       component: () => import('@/view/data-analysis/success-rate.vue')
  //     }
  //   ]
  // },
  {
    path: '/check_management',
    name: 'check_management',
    meta: {
      icon: 'md-cloud-upload',
      title: '对账管理',
      showAlways: true
    },
    component: Main,
    children: [
      {
        path: 'merchant_statement',
        name: 'merchant_statement',
        meta: {
          icon: 'ios-document',
          title: '商户对账单'
        },
        component: () => import('@/view/check-management/merchant-statement.vue')
      },
      {
        path: 'statement-edit',
        name: 'statement-edit',
        meta: {
          icon: '_qq',
          title: '编辑',
          hideInBread: true,
          hideInMenu: true
        },
        component: () => import('@/view/check-management/statement-edit')
      }
    ]
  },
  {
    path: '/system_management',
    name: 'system_management',
    meta: {
      icon: 'md-cloud-upload',
      title: '系统管理'
    },
    component: Main,
    children: [
      {
        path: 'user_management',
        name: 'user_management',
        meta: {
          icon: 'ios-document',
          title: '用户管理'
        },
        component: () => import('@/view/system-management/user-management.vue')
      },
      {
        path: 'role_management',
        name: 'role_management',
        meta: {
          icon: 'ios-document',
          title: '角色管理'
        },
        component: () => import('@/view/system-management/role-management.vue')
      },
	  {
	    path: 'access_menu',
	    name: 'access_menu',
	    meta: {
	      icon: 'ios-document',
	      title: '权限菜单管理'
	    },
	    component: () => import('@/view/system-management/access_menu.vue')
	  },

      // {
      //   path: 'news_management',
      //   name: 'news_management',
      //   meta: {
      //     icon: 'ios-document',
      //     title: '消息管理'
      //   },
      //   component: () => import('@/view/system-management/news-management.vue')
      // },
      {
        path: 'edit_log',
        name: 'edit_log',
        meta: {
          icon: 'ios-document',
          title: '操作日志'
        },
        component: () => import('@/view/system-management/edit-log.vue')
      },
      {
        path: 'safety_center',
        name: 'safety_center',
        meta: {
          icon: 'ios-document',
          title: '安全中心'
        },
        component: () => import('@/view/system-management/safety-center.vue')
      }
    ]
  },

  {
    path: '/pay_set',
    name: 'pay_set',
    component: Main,
    meta: {
      hideInBread: true,
      hideInMenu: true
    },
    children: [
      {
        path: 'payee-edit',
        name: 'payee-edit',
        meta: {
          icon: '_qq',
          title: '编辑'
        },
        component: () => import('@/view/pay-set/payee-edit.vue')
      },
      {
        path: 'payee-add',
        name: 'payee-add',
        meta: {
          icon: '_qq',
          title: '新增收款账户'
        },
        component: () => import('@/view/pay-set/payee-add.vue')
      }
    ]
  },

  {
    path: '/artifi-staff',
    name: 'artifi-staff',
    component: Main,
    meta: {
      hideInBread: true,
      hideInMenu: true
    },
    children: [
      {
        path: 'staff-add',
        name: 'staff-add',
        meta: {
          icon: '_qq',
          title: '新增'
        },
        component: () => import('@/view/artifi-staff/staff-add')
      },
      {
        path: 'staff-login',
        name: 'staff-login',
        meta: {
          icon: '_qq',
          title: '登录'
        },
        component: () => import('@/view/artifi-staff/staff-login')
      },
      {
        path: 'staff-capital',
        name: 'staff-capital',
        meta: {
          icon: '_qq',
          title: '资金明细'
        },
        component: () => import('@/view/artifi-staff/staff-capital')
      },
      {
        path: 'staff-change',
        name: 'staff-change',
        meta: {
          icon: '_qq',
          title: '余额变更'
        },
        component: () => import('@/view/artifi-staff/staff-change')
      },
      {
        path: 'staff-edit',
        name: 'staff-edit',
        meta: {
          icon: '_qq',
          title: '编辑'
        },
        component: () => import('@/view/artifi-staff/staff-edit')
      }
    ]
  },

  {
    path: '/user-manage',
    name: 'user-manage',
    component: Main,
    meta: {
      hideInBread: true,
      hideInMenu: true
    },
    children: [
      {
        path: 'user-edit',
        name: 'user-edit',
        meta: {
          icon: '_qq',
          title: '编辑'
        },
        component: () => import('@/view/user-manage/user-edit')
      },
      {
        path: 'user-add',
        name: 'user-add',
        meta: {
          icon: '_qq',
          title: '新增'
        },
        component: () => import('@/view/user-manage/user-add')
      }
    ]
  },
  {
    path: '/role-manage',
    name: 'role-manage',
    component: Main,
    meta: {
      hideInBread: true,
      hideInMenu: true
    },
    children: [
      {
        path: 'role-power',
        name: 'role-power',
        meta: {
          icon: '_qq',
          title: '分配权限'
        },
        component: () => import('@/view/role-manage/role-power')
      },
      {
        path: 'role-edit',
        name: 'role-edit',
        meta: {
          icon: '_qq',
          title: '编辑'
        },
        component: () => import('@/view/role-manage/role-edit')
      },
      {
        path: 'role-add',
        name: 'role-add',
        meta: {
          icon: '_qq',
          title: '新增'
        },
        component: () => import('@/view/role-manage/role-add')
      }
    ]
  },
  {
    path: '/news-manage',
    name: 'news-manage',
    component: Main,
    meta: {
      hideInBread: true,
      hideInMenu: true
    },
    children: [
      {
        path: 'news-view',
        name: 'news-view',
        meta: {
          icon: '_qq',
          title: '查看'
        },
        component: () => import('@/view/news-manage/news-view')
      },
      {
        path: 'news-edit',
        name: 'news-edit',
        meta: {
          icon: '_qq',
          title: '编辑'
        },
        component: () => import('@/view/news-manage/news-edit')
      },
      {
        path: 'news-add',
        name: 'news-add',
        meta: {
          icon: '_qq',
          title: '新建'
        },
        component: () => import('@/view/news-manage/news-add')
      }
    ]
  },
  {
    path: '/menu-manage',
    name: 'menu-manage',
    component: Main,
    meta: {
      hideInBread: true,
      hideInMenu: true
    },
    children: [
      {
        path: 'menu-add',
        name: 'menu-add',
        meta: {
          icon: '_qq',
          title: '新增'
        },
        component: () => import('@/view/menu-manage/menu-add')
      },

      {
        path: 'menu-edit',
        name: 'menu-edit',
        meta: {
          icon: '_qq',
          title: '编辑'
        },
        component: () => import('@/view/menu-manage/menu-edit')
      },
      {
        path: 'menu-add-sub',
        name: 'menu-add-sub',
        meta: {
          icon: '_qq',
          title: '新增子菜单'
        },
        component: () => import('@/view/menu-manage/menu-add-sub')
      }
    ]
  }
]
